package com.itheima.controller;


import com.itheima.pojo.User;
import com.itheima.service.IUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 用户表 前端控制器
 * </p>
 *
 * @author dida
 * @since 2023-08-25
 */
@RestController
@Slf4j
//@RequestMapping("/user")
public class UserController {
    @Autowired
    private IUserService userService;
    @GetMapping("/users/{ids}")
    @PreAuthorize("hasAnyAuthority('testr')")
    public List<User> queryUser(@PathVariable List<Integer> ids) {
        log.info("查询用户");
       List<User> users= userService.getUserByIds(ids);
       return users;
    }


}
